//
//  OMOrderLogTypeTableCell.m
//  OMENGO_NEW
//
//  Created by 梁尚嘉 on 2017/5/12.
//  Copyright © 2017年 Kamfat. All rights reserved.
//
#import "OMOrderDetailResponse.h"
#import "OMOrderLogTypeTableCell.h"
#import "OMOrderLog.h"
@interface OMOrderLogTypeTableCell ()
@property (nonatomic, strong) UIView *containView;
@property (nonatomic, strong) UILabel *elementLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UIImageView *iconImageView;
@property (nonatomic, strong) UIView *tvLine;
@property (nonatomic, strong) UIView *bvLine;

@end


@implementation OMOrderLogTypeTableCell

- (void)setIsLast:(BOOL)isLast
{
    _isLast = isLast;
    self.bvLine.hidden = isLast;
}

- (void)setIsFirst:(BOOL)isFirst
{
    _isFirst = isFirst;
    self.containView.layer.borderColor = [_isFirst?SM_thumeColor:HEXCOLOR(@"cccccc") CGColor];
    self.iconImageView.image = [UIImage imageNamed:_isFirst?@"ic_order_type_highlighted":@"ic_order_type_normal"];
    self.tvLine.hidden = isFirst;
}

- (void)configure
{
    [super configure];

    self.contentView.backgroundColor = SM_backGroundColor;

    _iconImageView = [UIImageView new];
    [self.contentView addSubview:_iconImageView];
    [_iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(30)));
        make.centerY.equalTo(self.contentView.mas_centerY);
    }];

    _containView = [UIView new];
    _containView.backgroundColor = SM_whiteColor;
    [self.contentView addSubview:_containView];
    [_containView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconImageView.mas_right).offset(SM_SIZE(30));
        make.right.equalTo(@(SM_SIZE(-30)));
        make.top.equalTo(@(SM_SIZE(25)));
        make.bottom.equalTo(@(SM_SIZE(-25)));
    }];
    _containView.layer.borderWidth = 1.0;

    _tvLine = [UIView new];
    _tvLine.backgroundColor = HEXCOLOR(@"#CCCCCC");
    [self.contentView addSubview:_tvLine];
    [_tvLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.iconImageView.mas_centerX);
        make.bottom.equalTo(self.iconImageView.mas_top).offset(SM_SIZE(-10));
        make.top.equalTo(@(SM_SIZE(0)));
        make.width.equalTo(@(SM_SIZE(3)));
    }];


    _bvLine = [UIView new];
    _bvLine.backgroundColor = HEXCOLOR(@"#CCCCCC");
    [self.contentView addSubview:_bvLine];
    [_bvLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(_tvLine.mas_centerX);
        make.top.equalTo(_iconImageView.mas_bottom).offset(SM_SIZE(10));
        make.width.equalTo(@(SM_SIZE(3)));
        make.bottom.equalTo(@0);
    }];


    _elementLabel = [UILabel new];
    _elementLabel.font = SM_CFont(30);
    _elementLabel.textColor = SM_blackColor;
    _elementLabel.text = @"商家已接单";
    [self.containView addSubview:_elementLabel];
    [_elementLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(SM_SIZE(25)));
        make.centerY.equalTo(self.containView.mas_centerY);
    }];

    _timeLabel = [UILabel new];
    _timeLabel.font = SM_NFont(26);
    _timeLabel.textColor = HEXCOLOR(@"#6F6F6F");
    _timeLabel.text = @"05-11 10:19";
    [self.containView addSubview:_timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(SM_SIZE(-25)));
        make.centerY.equalTo(self.containView.mas_centerY);
    }];

}


- (void)configureCellWithObj:(OMOrderLog *)log
{
    self.timeLabel.text = log.create_date;
    self.elementLabel.text = log.typeName;
}


+ (CGFloat)cellHeight
{
    return SM_SIZE(160);
}

@end
